/*Copyright (C) 2013-2020 LZE*/
#include<bits/stdc++.h>
#define INF 0x7f7f7f7f
using namespace std;
typedef long long ll;
ll n,m;
struct node{
	ll v,n;
}a[1000000];
bool cmp(node a,node b){
	return a.v<b.v;
}
int main() {
	cin>>n;
	for(ll i=1;i<=n;i++){
		cin>>a[i].v;
		a[i].n=i;
	}
	sort(a+1,a+1+n,cmp);
	cin>>m;
	int l=1,r=n;
	while(l<r){
		ll mid=(l+r)/2;
		if(a[mid].v>=m)r=mid;
		else l=mid+1;
	}
	if(a[l].v==m)cout<<l<<" ";
	else cout<<-1<<" ";
	return 0;
}
